<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" import="java.util.List"
	import="java.util.ArrayList"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
        <!DOCTYPE html>
        <html>

        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <title>商品添加</title>
            <style type="text/css">
				    div{line-height: 80px;text-align: left;}
				
					input{width: 200px;height: 20px;}
			</style>
            <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
            <script type="text/javascript">
				function add(){
					var goods = new Object();
					goods.name = $("#goods_name").val();
					goods.stockNum = $("#goods_stock_num").val();
					goods.price = $("#goods_price").val();
					goods.picture = $("#goods_picture").val();
					goods.delFlag = $("#goods_del_flag").val();
					jQuery.ajax({
						async : true,
						data : JSON.stringify(goods),
						dataTyep : "JSON",
						contentType: "application/json;charset=UTF-8",
                        success: function(result) {
                            alert("添加成功");
                        },
                        error: function(result) {},
                        type: "POST",
                        url: "/foodie/add"
                    });
				
			}
            </script>
        </head>

        <body>
        	<a href="http://localhost:8080/foodie/get"><button style="float:right">返回</button></a>
        	<div style="margin-left:200px;line-height: 40px;text-align: right; ">
        		<div>
        			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>产品名字：</label>
        			<input style="width: 200px;height: 20px;" type="text" id="goods_name" name="goods_name" /><br/>
        		</div>
        		
        		<div>
        			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>库存总量：</label>
        			<input style="width: 200px;height: 20px;"	type="text" id="goods_stock_num" name="goods_stock_num" /><br/>
        		</div>
        		
        		<div>
        			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>产品单价：</label>
        			<input style="width: 200px;height: 20px;" type="text" id="goods_price" name="goods_price" /><br/>
        		</div>
        		
        		<div>
        			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>图片路径：</label>
        			<input style="width: 200px;height: 20px;" type="text" id="goods_picture" name="goods_picture" /><br/>
        		</div>
        		
        		<div>
        			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>删除标识：</label>
        			<input style="width: 200px;height: 20px;" type="text" id="goods_del_flag" name="goods_del_flag" /><br/>
        		</div>
				<div><input style="margin-left:80px" type="button" onclick="add()" value="添加"></div>
			</div>
        </body>
		</html>